package com.lizhi.yun.db.rsz.entity;/**
 * @program: hbsf
 * @name RszPrescriptionEntity
 * @description: 处方表
 * @author: lizhi
 * @create: 2021-08-12 16:00
 */

import com.lizhi.mybatis.boot.Description;
import com.lizhi.yun.db.rsz.enums.RszIsTrainEnum;
import com.lizhi.yun.db.rsz.enums.RszPreTypeEnum;
import lombok.Data;
import lombok.ToString;

import javax.persistence.*;
import java.util.List;

/**
 *@program: hbsf
 *@name RszPrescriptionEntity
 *@description: 处方表
 *@author: lizhi
 *@create: 2021-08-12 16:00
 */
@Data
@ToString
@Table(name = "rsz_prescription")
@Entity
@Description("处方表")
public class RszPrescriptionEntity extends AbstractVrEntity {

    @Id
    @Column(columnDefinition="varchar(30) COMMENT 'lid'")
    @Description("lid")
    public String lid;

    @Column(columnDefinition="varchar(30) COMMENT '处方id'")
    public String preId;

    @Column(columnDefinition="varchar(30) COMMENT '患者id'")
    public String ptId;

    @Column(columnDefinition="int(11) COMMENT '处方时间（分钟存储）'")
    public Integer preTime;

    /**
     * @see com.lizhi.yun.db.rsz.enums.RszPreTypeEnum
     */
    @Column(columnDefinition="varchar(2) COMMENT '处方类型'")
    public String preType;

    @Transient
    public String preTypeText;

    @Column(columnDefinition="varchar(4000) COMMENT '康复游戏名称'")
    public String preGameName;

    /**
     * @see com.lizhi.yun.db.rsz.enums.RszIsTrainEnum
     */
    @Column(columnDefinition="varchar(2) COMMENT '该处方是否已训练'")
    public String preIsTrain;

    @Transient
    public String preIsTrainText;

    @Transient
    public RszPatientEntity rszPatientEntity;

    @Transient
    @Description("动作集合")
    public List<RszPrescriptionItemEntity> rszPrescriptionItemEntitys;


    public String getPreTypeText() {
        if (RszPreTypeEnum.Pre_Type_00.getEnValue().equals(preType)){
            preTypeText = RszPreTypeEnum.Pre_Type_00.getEnName();
        } else if (RszPreTypeEnum.Pre_Type_01.getEnValue().equals(preType)){
            preTypeText = RszPreTypeEnum.Pre_Type_01.getEnName();
        }
        return preTypeText;
    }

    public String getPreIsTrainText() {
        if(RszIsTrainEnum.Is_Train_00.getEnValue().equals(preIsTrain)){
            preIsTrainText = RszIsTrainEnum.Is_Train_00.getEnName();
        } else if(RszIsTrainEnum.Is_Train_01.getEnValue().equals(preIsTrain)){
            preIsTrainText = RszIsTrainEnum.Is_Train_01.getEnName();
        }
        return preIsTrainText;
    }
}
